<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>信息登记</title>
	<meta name="decorator" content="default"/>
	<link href="${ctxStatic}/file/css/fileinput.css"  rel="stylesheet" type="text/css" />  
	<script src="${ctxStatic}/file/js/fileinput.min.js" type="text/javascript"></script>  
	 <script src="${ctxStatic}/file/js/fileinput_locale_zh.js" type="text/javascript"></script> 
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
		function chong(){
			var b=$("#did").val();//获取当前用户重新赋值
		    $(':input,#inputForm')  
	         .not(':button, :submit, :reset, :hidden')  
	         .val('')  
	         .removeAttr('checked')  
	         .removeAttr('selected');   
		    $("#did").val(b);
		}

		
		
		function shang(){
			$('#demoModal').modal('show');
		}
		
		function shangchuan(){
			var form = new FormData(document.getElementById("userfile"));
			 form.append("file", form); 
		    $.ajax({  
		         url : "${ctx}/numberinfo/yhcgNumberinfo/file",  
		         type : "POST",  
		         data : form,
		         contentType: false,
		         processData: false,
		         success : function(data) {  
		        	$("#filename").val(data.name);
		        	$("#fileurl").val(data.url);
		        	document.getElementById("sfid").innerHTML=data.name;
		             alert("上传成功");
		         },  
		         error : function(data) {  
		             alert("上传失败");
		         }  
		    });  
		}
		$(function(){
			$("#left", parent.document).show();
			var content_iframe = window.parent.document.getElementById("right");
			content_iframe.style.width= "88%";
			
		})
	</script>
	<style type="text/css">
	#cs1,#cs2,#tid1,#tid2,#tid3,#tid4,.input-medium{
	width: 60%
	}
	
	#tid{
	width: 25%
	}
	</style>
</head>
<body>
<div>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/numberinfo/yhcgNumberinfo/form?id=${yhcgNumberinfo.id}">信息登记</a></li>
		<li><a href="${ctx}/numberinfo/yhcgNumberinfo/">查看已登记</a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="yhcgNumberinfo" action="${ctx}/numberinfo/yhcgNumberinfo/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>	
		<table >
		<tr><td colspan="2"><h4 style="color: blue;font-size: 16px;padding-left: 3%">【联系人信息】</h4></td></tr>
		<tr><td>
		<div class="control-group">
			<label class="control-label">姓名：</label>
			<div class="controls">
				<form:input path="name" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
			</div>
		</div>
		</td>
		<td>
		<div class="control-group">
			<label class="control-label">电话：</label>
			<div class="controls">
				<form:input path="phone" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
			</div>
		</div>
		</td>
		</tr>
			<tr><td colspan="2"><h4 style="color: blue;font-size: 16px;padding-left: 3%">【内容描述】</h4></td></tr>
		<tr>
		<td>
		<div class="control-group">
			<label class="control-label">来源：</label>
			<div class="controls">
			<form:select path="come" class="input-medium required"   type="select[disabled]">
					<form:options items="${fns:getDictList('come_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</div>
		</div>
		</td>
		<td>
		<div class="control-group">
			<label class="control-label">事件类别：</label>
			<div class="controls">
			<form:select path="type" class="input-medium required">
					<form:options items="${fns:getDictList('type_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</div>
		</div>
		</td>
		
		</tr>
		<tr>
		<td colspan="2">
		<div class="control-group">
			<label class="control-label">附件上传：</label>
			<div class="controls">
				<form:hidden path="filename" htmlEscape="false" maxlength="255" class="input-xlarge" />
				<form:hidden path="fileurl" htmlEscape="false" maxlength="255" class="input-xlarge" />
				<input id="btnSubmitshang" class="btn btn-primary" type="button" value="附件上传" onclick="shang()"/>
				<span id="sfid">
				${name}
				</span>
			</div>
		</div>
		</td>
		</tr>
		<tr>
		<td colspan="4">
			<div class="control-group">
			<label class="control-label">内容：</label>
			<div class="controls">
				<form:textarea path="content" htmlEscape="false" rows="6" class="input-xxlarge" id="cs1"/>
				<span><font color="red">*不能大于1500字</font></span>
			</div>
		</div>
		</td>
		
		<tr>
		<td colspan="4">
		<div class="control-group">
			<label class="control-label">备注：</label>
			<div class="controls">
			<form:textarea path="remark" htmlEscape="false" rows="6" class="input-xxlarge" id="cs2"/>
				<span><font color="red">*不能大于1500字</font></span>
			</div>
		</div>
		</td>
		</tr>
		<tr>
		<td>
		<div class="control-group">
			<label class="control-label">登记人：</label>
			<div class="controls">
				<form:input path="registrant" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
			</div>
		</div>
	
		</td>
		<td>
		<div class="control-group">
			<label class="control-label">办理人：</label>
			<div class="controls"> 
				<form:input path="administrator" htmlEscape="false" maxlength="255"   class="input-xlarge required" onfocus="this.blur()" value="${fns:getUser().name}" id="did"/>
			</div>
		</div>
		</td>
		</tr>
		<tr>
		<td colspan="2">
		<div class="control-group">
			<label class="control-label">办理期限：</label>
			<div class="controls">
				<input name="timelimit" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate required"
					value="<fmt:formatDate value="${yhcgNumberinfo.timelimit}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});" id="tid"/>
			</div>
		</div>
		</td>
		</tr>
		<tr><td colspan="2"><h4 style="color: blue;font-size: 16px;padding-left: 3%">【分流派遣】</h4></td></tr>
		
		<tr>
		<td>
		<div class="control-group">
			<label class="control-label">责任单位：</label>
			<div class="controls">
				<form:select  path="responsibilityunit" class="input-medium" >
					<form:options items="${list}" itemLabel="name" itemValue="id" htmlEscape="false"/>
				</form:select>
				<%-- <form:input path="responsibilityunit" htmlEscape="false" maxlength="255" class="input-xlarge "/> --%>
			</div>
		</div>
		</td>
		<td>
		<div class="control-group">
			<label class="control-label">督办单位：</label>
			<div class="controls">
				<form:select  path="supervisionunit" class="input-medium" >
					<form:options items="${list1}" itemLabel="name" itemValue="id" htmlEscape="false"/>
				</form:select>
			<%-- <form:select path="supervisionunit" class="input-medium required">
					<form:options items="${list1}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select> --%>
				<%-- <form:input path="supervisionunit" htmlEscape="false" maxlength="255" class="input-xlarge "/> --%>
			</div>
		</div>
		</td>
		
		</tr>
		</table>
		<div class="form-actions" >
			<shiro:hasPermission name="numberinfo:yhcgNumberinfo:edit">
			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存" />&nbsp;
			</shiro:hasPermission>
			<c:if test="${empty yhcgNumberinfo.id}">
			<input id="btnSubmitzhi" class="btn" type="button" value="重 置" onclick="chong()"/>
			</c:if>
			<c:if test="${not empty yhcgNumberinfo.id}">
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
			</c:if>
		</div>
	</form:form>
	</div>
	<div class="modal fade" id="demoModal" tabindex="-1" role="dialog" aria-labelledby="demoModalLabel" aria-hidden="true" data-backdrop="static" style="width: 300px;">
        <div class="modal-dialog" >
             <div class="modal-content">
                 <div class="modal-header">
                      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                      <h4 class="modal-title" id="demoModalLabel">文件上传</h4>
                 </div>
                 <div class="modal-body" style="height: 150px;">
                     <form action="" method="post" id="userfile" enctype="multipart/form-data">
			        	<input type="file" name="file" id="file"  /> 
     				   </form>  
                     <button type="button" class="btn btn-default" data-dismiss="modal" onclick="shangchuan()" >上传</button>
                     </div>
             </div>
         </div>
    </div>
</body>
</html>